<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //         0 1 2 3 4
        var arr = [1,2,3,4];
        // 动态向数组的最后追加元素
        arr[arr.length] = 5;
        arr[arr.length] = 6;
        arr[arr.length] = 7;
        arr[arr.length] = 8;
        console.log(arr, arr.length);
    </script>
</body>
</html>